package com.guchenbo.spring.boot.jdbc.spring;

import com.guchenbo.spring.boot.jdbc.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

/**
 * 使用Spring jdbc 的JdbcTeamplate
 *
 * @Author guchenbo
 * @Date 2019/8/14.
 */
@Component
public class UserSpringDao implements UserDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public void insert() {
        String sql = "insert into user(`name`, age) values ('jay', 12)";
        jdbcTemplate.execute(sql);
    }
}
